import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      imports: ["vue", "vue-router"],
      resolvers: [ElementPlusResolver()],
      // eslintrc: {
      //   enabled: false,
      //   filepath: "./.eslintrc-auto-import.json",
      //   globalsPropValue: true,
      // },
    }),
    Components({
      dts: true,
      dirs: ["src/components"],
      resolvers: [ElementPlusResolver()],
    }),
  ],
  server: {
    host: true,
    // port: 5000 // 指定端口号
    // proxy: {
    //   "/users": {
    //     target: "http://192.168.2.180:5000",
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/users/, ""),
    //   },
    // },
  },
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
      "~": resolve(__dirname, "src/components"),
      "#": resolve(__dirname, "src/views"),
      "*": resolve(__dirname, "src/assets"),
    },
  },
});
